#ifndef __AnimationSet_h_
#define __AnimationSet_h_


#include <OgreBillBoardSet.h>
#include <OgreBillBoard.h>
#include <OgreCamera.h>
#include <OgreEntity.h>
#include <OgreLogManager.h>
#include <OgreRoot.h>
#include <OgreViewport.h>
#include <OgreSceneManager.h>
#include <OgreRenderWindow.h>
#include <OgreConfigFile.h>
#include <OgreMaterialManager.h>

#include <stdio.h>

using namespace Ogre;
class AnimationSet
{

#define INITIALIZING 0
#define INITIALIZED  1
#define UNINITIALIZE  2


public:


	short state;
	bool oneLoopFinished;
	short _frameCount;
	short _frameInterval;
	int _currentFrame;
	short _frameStart;
	std::string _nameHead;
	Real lastTime;
	Real timeInterval;
	Real timeCurrent;
	
	AnimationSet(Ogre::SceneManager *mMgr){
		mSceneManager = mMgr;
		state = UNINITIALIZE;
		_currentFrame = 2;
		lastTime = 0;
		timeCurrent = 0;
		timeInterval = 16.0f/10000.0f;
	};
	~AnimationSet(){};

	//create textureUnitState, loaded to VRam
	void AnimationSetCreate(const String id, const String nameHead, short frameCount, short framInterval, short frameStart = 0);
	
	//set Position
	void setPosition(Vector3);
	//set Size
	void setDimension(Vector2 _p);

	void setRenderQueueGroup(Ogre::RenderQueueGroupID id);

	//loaded while loop function to play a animationSet
	void play(Real);
	
	//cease animation
	void cease();
	
	//restart, play from the very begining
	void restart();

	//unload animation set
	void unLoad();

	void setTimeInterval(Ogre::Real t);

	void setVisable(bool);

	bool reportOneRoundFinished();
	void reset();//make loop flag reset.

	Ogre::Pass * getMaterialPass();


protected:


	BillboardSet* _pBillBoard;
	SceneNode* _mNode;
	Ogre::SceneManager *mSceneManager;



};





#endif 